<template>
  <div>
    <div class="main">
      <el-container class="main-content">
        <el-aside :width="isCollapse ? '60px' : '210px'">
          <nav-menu :collapse="isCollapse" />
        </el-aside>
        <el-container class="page">
          <el-header class="page-header">
            <nav-header @fold-change="handleFoldChange" />
          </el-header>
          <el-main class="page-content">
            <router-view></router-view>
          </el-main>
        </el-container>
      </el-container>
    </div>
  </div>
</template>

<script lang="ts" setup>
import { ref } from 'vue'

import NavHeader from '@/components/nav-header'
import NavMenu from '@/components/nav-menu'

const isCollapse = ref(false)
const handleFoldChange = (isFold: boolean) => {
  isCollapse.value = isFold
}
</script>

<style scoped lang="less">
.main {
  position: fixed;
  width: 100%;
  height: 100%;
  top: 0;
  left: 0;
}
.main-content,
.page {
  height: 100%;
}
.el-header {
  height: 48px !important;
}
.page-content {
  height: calc(100%-48px);
}
.el-aside {
  overflow-y: auto;
  overflow-x: hidden;
  text-align: left;
  cursor: pointer;
  background-color: #001529;
  transition: width 0.3s linear;
  scrollbar-width: none; /* firefox */
  -ms-overflow-style: none; /* IE 10+ */
  &::-webkit-scrollbar {
    display: none;
  }
}
.el-main {
  color: #333;
  text-align: center;
  background-color: #f0f2f5;
}
.el-header,
.el-footer {
  display: flex;
  color: #333;
  text-align: center;
  align-items: center;
}
</style>
